home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20010921-20020314 / 000136_spcecdt@deeptht.armory.com_Fri Nov 9 09:29:30 EST 2001.msg < prev    next >
Text File  |  2020-01-01  |  2KB  |  50 lines

  1. Article: 12955 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!panix!howland.erols.net!news.maxwell.syr.edu!news-out.visi.com!hermes.visi.com!gemini.tycho.net.POSTED!not-for-mail
  3. Newsgroups: comp.unix.sco.misc,comp.protocols.kermit.misc
  4. Subject: Re: OSR5 <sys/termio.h> (OSR5 modem signals)
  5. References: <9s775v$ip0$1@newsmaster.cc.columbia.edu> <9sc7ku$81i$1@newsmaster.cc.columbia.edu> <3bea05eb$0$79559$8eec23a@newsreader.tycho.net> <9se63k$kqo$1@newsmaster.cc.columbia.edu>
  6. Organization: The Armory
  7. X-Newsreader: trn 4.0-test69 (20 September 1998)
  8. From: spcecdt@deeptht.armory.com (John DuBois)
  9. Date: 09 Nov 2001 02:35:22 GMT
  10. Lines: 33
  11. Message-ID: <3beb40ea$0$79556$8eec23a@newsreader.tycho.net>
  12. NNTP-Posting-Host: 4e8892dd.newsreader.tycho.net
  13. X-Trace: 1005273322 gemini.tycho.net 79556 spcecdt@192.122.209.42
  14. X-Complaints-To: abuse@tycho.net
  15. Xref: newsmaster.cc.columbia.edu comp.unix.sco.misc:140065 comp.protocols.kermit.misc:12955
  16.  
  17. In article <9se63k$kqo$1@newsmaster.cc.columbia.edu>,
  18. Frank da Cruz <fdc@watsun.cc.columbia.edu> wrote:
  19. >  ttyfd = open(name,O_RDWR|O_NONBLOCK);
  20. >  tcsetattr(ttyfd,TCSADRAIN,&ttcur);
  21. >
  22. >... any write() to the reopened device gets error 11, "Resource
  23. >temporarily unavailable".  Did I miss a step?  Or is this a difference
  24. >between 5.0.6a and earlier OSR5s?
  25.  
  26. You missed a step (the same one that a lot of app writers did); it's one that
  27. didn't trip anyone up until tty behaviour was made POSIX-correct in 5.0.0. 
  28. POSIX requires that O_NONBLOCK make tty io non-blocking, which is rarely what
  29. you want - O_NONBLOCK is almost always used just to allow opening of a
  30. modem-control line without DCD being asserted.  After opening the device, you
  31. need to turn off non-blocking mode with something like:
  32.  
  33.     tcsetattr CLOCAL, else the following will disable IO until DCD is
  34.     asserted.
  35.         if ((flags = fcntl (ttyfd, F_GETFL)) == -1)
  36.         error...
  37.         flags &= ~O_NONBLOCK;
  38.     if (fcntl (ttyfd, F_SETFL, flags) == -1)
  39.         error...
  40.  
  41. I don't know why you didn't encounter this in earlier 5.0, and you also should
  42. not encounter it until you've written enough data to fill up the tty output
  43. buffer (that's when non-blocking mode causes writes to start failing with errno
  44. 11).  But in any case, my guess is that adding the above will resolve your
  45. problem.
  46.  
  47.     John
  48. -- 
  49. John DuBois  spcecdt@armory.com.  KC6QKZ/AE  http://www.armory.com./~spcecdt/
  50.